//
//  FrequentlyQuestionTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/20.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "FrequentlyQuestionTableViewCell.h"

@interface FrequentlyQuestionTableViewCell ()

@property (strong, nonatomic) UILabel *titleL;

@property (strong, nonatomic) UIImageView *arrowIV;


@end

@implementation FrequentlyQuestionTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        [self.contentView addSubview:self.titleL];
        [self.contentView addSubview:self.arrowIV];
//        [self.contentView addSubview:self.desL];
    }
    
    return self;
}

- (void)setQuestionModel:(FrequentlyQuestionModel *)questionModel {
    
    _questionModel = questionModel;
    self.titleL.text = questionModel.news_title;
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    /*
     NSString *labelText = string;
     NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(jisuan(5))}];
     NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
     [paragraphStyle setLineSpacing:jisuan(10)];
     [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
     self.tipContentLabel.attributedText = attributedString;
     self.tipContentLabel.lineBreakMode = NSLineBreakByTruncatingTail;
     
     CGSize size = [self.tipContentLabel sizeThatFits:CGSizeMake((AlertView_W - 2 * Margin), CGFLOAT_MAX)];
     
     CGFloat labH = size.height < MessageMin_H ? MessageMin_H : size.height;
     CGFloat MaxLabH = labH > MessageMax_H ? MessageMax_H : labH;
     
     self.scrollview.frame = CGRectMake(Margin, self.tipImageView.height + TopMargin + Margin, AlertView_W - 2 * Margin, MaxLabH);
     */

    __weak typeof(self) weakSelf = self;
    
    [self.arrowIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.width.mas_equalTo(jisuan(12));
        make.height.mas_equalTo(jisuan(20));
    }];
    
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(40));
        make.right.mas_equalTo(weakSelf.arrowIV.mas_left).with.offset(-jisuan(20));
        make.top.mas_equalTo(weakSelf.contentView.mas_top);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom);
        
    }];
//    [self.desL mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(40));
//        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
//        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(10));
//
//        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(10));
//    }];
}


#pragma mark -lazy
- (UILabel *)titleL {
    
    if (!_titleL) {
        
        _titleL = [[UILabel alloc] init];
        _titleL.textColor = Color333333;
        _titleL.textAlignment = NSTextAlignmentLeft;
        _titleL.font = Font(24);
    }
    
    return _titleL;
}

- (UIImageView *)arrowIV {
    
    if (!_arrowIV) {
        
        _arrowIV = [[UIImageView alloc] init];
        _arrowIV.image = [UIImage imageNamed:@"sectionHeaderArrowDownBG"];
        _arrowIV.contentMode = UIViewContentModeScaleAspectFit;
    }
    
    return _arrowIV;
}

//- (UILabel *)desL {
//
//    if (!_desL) {
//
//        _desL = [[UILabel alloc] init];
//        _desL.textColor = Color999999;
//        _desL.textAlignment = NSTextAlignmentLeft;
//        _desL.numberOfLines = 0;
//        _desL.font = Font(24);
//    }
//
//    return _desL;
//}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
